package com.medical.common;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Constants {

	private static Log logger = LogFactory.getLog(new Constants(){}.getClass().getName());
	/**
	 *  口袋医助地址
	 */
//	public static final String POCKET_MEDICAL_URL = "http://127.0.0.1:8080/PocketMedical";
	public static final String POCKET_MEDICAL_URL = getWebConfig().getProperty("POCKET_MEDICAL_URL");
	
	/**
	 *  健康管理地址
	 */
//	public static final String YILIFE_URL = "http://kdyztest.ikdys.com:8080/YilifeHealth";
	public static final String YILIFE_URL = getWebConfig().getProperty("YILIFE_URL");
	
	/**
	 *  图片地址
	 */
	public static final String YILIFE_IMAGE_URL = getWebConfig().getProperty("YILIFE_IMAGE_URL");

	private static Properties _webConfig;
	public static Properties getWebConfig(){
		if(_webConfig == null) {
			_webConfig = new Properties();

			try {
				InputStream in = new Constants(){}.getClass().getClassLoader().getResourceAsStream("config.properties");
				_webConfig.load(in);
			} catch (FileNotFoundException e) {
				e.printStackTrace();
				logger.error(e);
			} catch (IOException e) {
				e.printStackTrace();
				logger.error(e);
			}
		}
		return _webConfig;
	}
}
